package com.shell.customer.invitation.service.impl;

import com.shell.bee.base.utils.StringUtil;
import com.shell.bee.persistence.annotation.Pagination;
import com.shell.bee.persistence.model.PageLimit;
import com.shell.customer.base.dao.InviteStatisticsDao;
import com.shell.customer.invitation.service.InviteStatisticsService;
import com.shell.customer.invitation.vo.InviteStatisticsVo;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("inviteStatisticsService")
public class InviteStatisticsServiceImpl implements InviteStatisticsService {
	@Autowired
	private InviteStatisticsDao inviteStatisticsDao;

	@Pagination
	public List<InviteStatisticsVo> getInviteStatisticsList(PageLimit limit, String cusType, String searchStr) {
		if (StringUtil.notEmpty(searchStr)) {
			searchStr = StringUtil.getParameterLike(searchStr);
		}
		return this.inviteStatisticsDao.getInviteStatisticsList(cusType, searchStr);
	}

	public List<InviteStatisticsVo> getInviteStatisticsDetail(String userId, String statisticsType) {
		if ("register".equals(statisticsType)) {
			return this.inviteStatisticsDao.getRegisterInviteStatisticsDetail(userId);
		}
		if ("accreditation".equals(statisticsType)) {
			return this.inviteStatisticsDao.getAccreditationInviteStatisticsDetail(userId);
		}
		if ("dct".equals(statisticsType)) {
			return this.inviteStatisticsDao.getDctInviteStatisticsDetail(userId);
		}
		return null;
	}

	public Map<String, Object> getInviteStatisticsTotal(String cusType, String searchStr) {
		if (StringUtil.notEmpty(searchStr)) {
			searchStr = StringUtil.getParameterLike(searchStr);
		}
		return this.inviteStatisticsDao.getInviteStatisticsTotal(cusType, searchStr);
	}
}
